package aiP.A3.BuchhaltungKomponente.DataAccessLayer.Entity;

import aiP.A3.PersistenceService.iEntity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created with IntelliJ IDEA.
 * User: Hero
 * Date: 22.05.14
 * Time: 13:51
 * To change this template use File | Settings | File Templates.
 */
// Max
 @javax.persistence.Table(name = "AI_KUNDE", schema = "AIP", catalog = "")
//Stephan
//@javax.persistence.Table(name = "AI_KUNDE", schema = "HR", catalog = "")
@Entity
public class Kunde implements iEntity {
    private int kundeId;

    @javax.persistence.Column(name = "KUNDE_ID")
    @Id
    public int getKundeId() {
        return kundeId;
    }

    public void setKundeId(int kundeId) {
        this.kundeId = kundeId;
    }

    private String name;

    @javax.persistence.Column(name = "NAME")
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String anschrift;

    @javax.persistence.Column(name = "ANSCHRIFT")
    @Basic
    public String getAnschrift() {
        return anschrift;
    }

    public void setAnschrift(String anschrift) {
        this.anschrift = anschrift;
    }

    private Integer angebotsNr;

    @javax.persistence.Column(name = "ANGEBOTS_NR")
    @Basic
    public Integer getAngebotsNr() {
        return angebotsNr;
    }

    public void setAngebotsNr(Integer angebotsNr) {
        this.angebotsNr = angebotsNr;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Kunde kunde = (Kunde) o;

        if (kundeId != kunde.kundeId) return false;
        if (angebotsNr != null ? !angebotsNr.equals(kunde.angebotsNr) : kunde.angebotsNr != null) return false;
        if (anschrift != null ? !anschrift.equals(kunde.anschrift) : kunde.anschrift != null) return false;
        if (name != null ? !name.equals(kunde.name) : kunde.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = kundeId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (anschrift != null ? anschrift.hashCode() : 0);
        result = 31 * result + (angebotsNr != null ? angebotsNr.hashCode() : 0);
        return result;
    }

    public String toString(){
        return "Kundenr: " + getKundeId() + "Name: " + getName() + " Anschrift: " + getAnschrift() + "Angebotsnr: " + getAngebotsNr();
    }
}
